<template>
  <div>
    <div class="detail">
      <div class="content" v-html="content">

      </div>
    </div>
    <footer class="fixed-footer">
      <input class="footer-fullW-bt" type="button" value="返回" @click="back">
    </footer>
  </div>
</template>
<script>
  import $ from 'edom'

  export default {
    name: 'newsDetail',
    data () {
      return {
        title: '合同详情',
        content: ''
      }
    },
    methods: {
      getDetail () {
        this.axios.post('/api/contract/detail', {
          user_loan_id: this.$route.params.id,
          user_id: this.$store.state.user_id,
          token: this.$store.state.token
        })
        .then((res) => {
          let data = res.data
          let desc = data.desc
          if (data.code !== 200) {
            $().Mnews(desc, 1000)
            return
          }
          this.content = data.contract
        })
      },
      back () {
        this.$router.go(-1)
      }
    },
    created () {
      this.setTitle(this.title)
      this.getDetail()
    }
  }
</script>
<style lang="scss" scoped>
  @function rem($px) {
    @return $px / 75 * 1rem;
  }
  .detail{
    margin-bottom: rem(100);
    padding: 0 rem(24);
    .content{
      padding: rem(20) 0;
      font-size: rem(26);
      color: #333;
      overflow: hidden;
      img{
        max-width: 100%;
      }
    }
  }
</style>
